/**
 * 文章管理接口
 */
import request from '@/utils/request';

// 根据id查询文章数据
export function getArticle(id) {
  return request({
    url: '/api/article/findById',
    method: 'get',
    params: {
      id
    }
  });
}

// 添加文章
export function add(data) {
  return request({
    url: '/api/article/add',
    method: 'post',
    data
  });
}

// 删除
export function del(id) {
  return request({
    url: '/api/article/delete/' + id,
    method: 'delete'
  });
}

// 查询分页  queryArticle: data
export function getList(pageNum, pageSize, data) {
  return request({
    url: '/api/article/findPage',
    method: 'post',
    params: {
      pageNum,
      pageSize
    },
    data: data
  });
}

// 修改
export function update(data) {
  return request({
    url: '/api/article/edit',
    method: 'post',
    data
  });
}

// 发表文章
export function publishOn(id) {
  return request({
    url: '/api/article/publishOn/' + id,
    method: 'post'
  });
}

// 取消发表文章
export function publishOff(id) {
  return request({
    url: '/api/article/publishOff/' + id,
    method: 'post'
  });
}

// 取消审核
export function statusOff(id) {
  return request({
    url: '/api/article/statusOff/' + id,
    method: 'post'
  });
}

// 通过审核
export function statusOn(id) {
  return request({
    url: '/api/article/statusOn/' + id,
    method: 'post'
  });
}
